.class Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;
.super Ljava/io/OutputStream;
.source "MIDletOutputStreamRedirector.java"


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lorg/microemu/app/util/MIDletOutputStreamRedirector;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "OutputStream2Log"
.end annotation


# instance fields
.field buffer:Ljava/lang/StringBuffer;

.field isErrorStream:Z


# direct methods
.method constructor <init>(Z)V
    .locals 1
    .parameter "error"

    .prologue
    .line 62
    invoke-direct {p0}, Ljava/io/OutputStream;-><init>()V

    .line 60
    new-instance v0, Ljava/lang/StringBuffer;

    invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V

    iput-object v0, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->buffer:Ljava/lang/StringBuffer;

    .line 63
    iput-boolean p1, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->isErrorStream:Z

    .line 64
    return-void
.end method


# virtual methods
.method public flush()V
    .locals 1

    .prologue
    .line 67
    iget-object v0, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->buffer:Ljava/lang/StringBuffer;

    invoke-virtual {v0}, Ljava/lang/StringBuffer;->length()I

    move-result v0

    if-lez v0, :cond_0

    .line 68
    const/16 v0, 0xa

    invoke-virtual {p0, v0}, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->write(I)V

    .line 70
    :cond_0
    return-void
.end method

.method public write(I)V
    .locals 2
    .parameter "b"

    .prologue
    .line 73
    const/16 v0, 0xa

    if-eq p1, v0, :cond_0

    const/16 v0, 0xd

    if-ne p1, v0, :cond_3

    .line 74
    :cond_0
    iget-object v0, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->buffer:Ljava/lang/StringBuffer;

    invoke-virtual {v0}, Ljava/lang/StringBuffer;->length()I

    move-result v0

    if-lez v0, :cond_1

    .line 75
    iget-boolean v0, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->isErrorStream:Z

    if-eqz v0, :cond_2

    .line 76
    iget-object v0, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->buffer:Ljava/lang/StringBuffer;

    invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lorg/microemu/log/Logger;->error(Ljava/lang/String;)V

    .line 80
    :goto_0
    new-instance v0, Ljava/lang/StringBuffer;

    invoke-direct {v0}, Ljava/lang/StringBuffer;-><init>()V

    iput-object v0, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->buffer:Ljava/lang/StringBuffer;

    .line 85
    :cond_1
    :goto_1
    return-void

    .line 78
    :cond_2
    iget-object v0, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->buffer:Ljava/lang/StringBuffer;

    invoke-virtual {v0}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-static {v0}, Lorg/microemu/log/Logger;->info(Ljava/lang/String;)V

    goto :goto_0

    .line 83
    :cond_3
    iget-object v0, p0, Lorg/microemu/app/util/MIDletOutputStreamRedirector$OutputStream2Log;->buffer:Ljava/lang/StringBuffer;

    int-to-char v1, p1

    invoke-virtual {v0, v1}, Ljava/lang/StringBuffer;->append(C)Ljava/lang/StringBuffer;

    goto :goto_1
.end method
